#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int maxLength(vector<int>& arr) {
        int n = arr.size();
        int hash[100005] = { 0 };
        int left = 0, right = 0, ret = 0;
        while (right < n)
        {
            hash[arr[right]]++;
            while (hash[arr[right]] > 1)
            {
                hash[arr[left++]]--;
            }
            ret = max(ret, right - left + 1);
            right++;
        }
        return ret;
    }
};
int main()
{
    return 0;
}